let fs = require('fs')
let pool = require('../../mysql/pool')
module.exports = (req, res) => {
  let querystr1 = 'select * from sessions'
  pool.query(querystr1, (err, result) => {
    if (err) return console.log(err.message)
    if (result.length === 0) {
      // 没登陆过
      res.redirect('http://8.138.146.253:9000/login')
    } else {
      // 登陆过
      fs.readFile('./public/html/riben.html', function (err, data) {
        res.send(data.toString())
      })
    }
  })

}
